# !/usr/bin/python3
# -*- coding: utf-8 -*-

"""
菜单权限表模型类
----------------------------------------------------
@Project :   xinhou-openai-framework
@File    :   Menu.py
@Contact :   sp_hrz@qq.com

@Modify Time      @Author    @Version    @Desciption
------------      -------    --------    -----------
2023/04/16 22:04  peng.shen   v1.0.0     None
"""

from datetime import datetime
from typing import Optional

from pydantic import BaseModel, Field


class ReqMenuFindSchema(BaseModel):
    """
    菜单权限表 查询入参参数&校验模型
    """

    id: Optional[int] = Field(default=None, title="菜单ID")
    menu_name: Optional[str] = Field(default=None, title="菜单名称")
    parent_id: Optional[int] = Field(default=None, title="父菜单ID:join=t_menu,index=1")
    order_num: Optional[int] = Field(default=None, title="显示顺序")
    url: Optional[str] = Field(default=None, title="请求地址")
    menu_type: Optional[int] = Field(default=None, title="菜单类型:1=目录,2=菜单,3=按钮")
    perms: Optional[str] = Field(default=None, title="权限标识")
    level: Optional[int] = Field(default=None, title="菜单层级")
    icon: Optional[str] = Field(default=None, title="菜单图标")
    is_frame: Optional[int] = Field(default=None, title="是否外链")
    visible: Optional[int] = Field(default=None, title="菜单状态:1=显示,2=隐藏")
    create_by: Optional[str] = Field(default=None, title="创建者")
    created_at: Optional[datetime] = Field(default=None, title="创建时间")
    update_by: Optional[str] = Field(default=None, title="更新者")
    updated_at: Optional[datetime] = Field(default=None, title="更新时间")
    remark: Optional[str] = Field(default=None, title="备注")


class ReqMenuSaveSchema(BaseModel):
    """
    菜单权限表 保存入参参数&校验模型
    """

    menu_name: Optional[str] = Field(title="菜单名称")
    parent_id: Optional[int] = Field(default='0', title="父菜单ID:join=t_menu,index=1")
    order_num: Optional[int] = Field(default='0', title="显示顺序")
    url: Optional[str] = Field(default='#', title="请求地址")
    menu_type: Optional[int] = Field(title="菜单类型:1=目录,2=菜单,3=按钮")
    perms: Optional[str] = Field(title="权限标识")
    level: Optional[int] = Field(default='0', title="菜单层级")
    icon: Optional[str] = Field(default='#', title="菜单图标")
    is_frame: Optional[int] = Field(default='2', title="是否外链")
    visible: Optional[int] = Field(default='1', title="菜单状态:1=显示,2=隐藏")
    create_by: Optional[str] = Field(default=None, title="创建者")
    update_by: Optional[str] = Field(default=None, title="更新者")
    remark: Optional[str] = Field(default=None, title="备注")


class ReqMenuUpdateSchema(BaseModel):
    """
    菜单权限表 更新入参参数&校验模型
    """
    id: int = Field(title="菜单ID")
    menu_name: Optional[str] = Field(default=None, title="菜单名称")
    parent_id: Optional[int] = Field(default=None, title="父菜单ID:join=t_menu,index=1")
    order_num: Optional[int] = Field(default=None, title="显示顺序")
    url: Optional[str] = Field(default=None, title="请求地址")
    menu_type: Optional[int] = Field(default=None, title="菜单类型:1=目录,2=菜单,3=按钮")
    perms: Optional[str] = Field(default=None, title="权限标识")
    level: Optional[int] = Field(default=None, title="菜单层级")
    icon: Optional[str] = Field(default=None, title="菜单图标")
    is_frame: Optional[int] = Field(default=None, title="是否外链")
    visible: Optional[int] = Field(default=None, title="菜单状态:1=显示,2=隐藏")
    create_by: Optional[str] = Field(default=None, title="创建者")
    update_by: Optional[str] = Field(default=None, title="更新者")
    remark: Optional[str] = Field(default=None, title="备注")


class ResMenuDetailSchema(BaseModel):
    """
    菜单权限表 查询出参参数&校验模型
    """

    id: Optional[int] = Field(default=None, title="菜单ID")
    menu_name: Optional[str] = Field(default=None, title="菜单名称")
    parent_id: Optional[int] = Field(default=None, title="父菜单ID:join=t_menu,index=1")
    order_num: Optional[int] = Field(default=None, title="显示顺序")
    url: Optional[str] = Field(default=None, title="请求地址")
    menu_type: Optional[int] = Field(default=None, title="菜单类型:1=目录,2=菜单,3=按钮")
    perms: Optional[str] = Field(default=None, title="权限标识")
    level: Optional[int] = Field(default=None, title="菜单层级")
    icon: Optional[str] = Field(default=None, title="菜单图标")
    is_frame: Optional[int] = Field(default=None, title="是否外链")
    visible: Optional[int] = Field(default=None, title="菜单状态:1=显示,2=隐藏")
    create_by: Optional[str] = Field(default=None, title="创建者")
    created_at: Optional[datetime] = Field(default=None, title="创建时间")
    update_by: Optional[str] = Field(default=None, title="更新者")
    updated_at: Optional[datetime] = Field(default=None, title="更新时间")
    remark: Optional[str] = Field(default=None, title="备注")
